package com.origin.onlinesys.service.modules.interviewsys.impl;

import com.origin.onlinesys.common.services.BaseService;
import com.origin.onlinesys.domain.modules.interviewsys.InterviewerTrace;
import com.origin.onlinesys.persistence.modules.interviewsys.InterviewerTraceMapper;
import com.origin.onlinesys.service.modules.interviewsys.IinterviewerTraceService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2015/1/22 0022.
 * 回访
 */
@Service
public class InterviewerTraceServiceImpl extends BaseService<InterviewerTrace> implements IinterviewerTraceService{
    /**
     * 添加回访
     * @param trace 回访对象
     * @return
     */
    public InterviewerTrace insertTrace(InterviewerTrace trace){
        trace.setState("1");
        trace.setId(this.save(trace)+"");
        return trace;
    }

    /**
     * 删除回访记录
     * @param id
     * @return
     */
    public int deleteTrace(String id){
        InterviewerTrace trace = new InterviewerTrace();
        trace.setId(id);
        trace.setState("2");
        return this.update(trace);
    }

    /**
     * 修改回访记录
     * @param trace
     * @return
     */
    public int updateTrace(InterviewerTrace trace){
        return this.update(trace);
    }

    /**
     * 查询所有数据
     * @return
     */
    public List<InterviewerTrace> selectAll(){
        return this.queryAll();
    }

    /**
     * 根据条件查询
     * @param trace
     * @return
     */
    public List<InterviewerTrace> selectByWhere(InterviewerTrace trace){
        return this.queryByWhere(trace);
    }

    /**
     * 根据面试者Id查询
     * @param id
     * @return
     */
    public List<InterviewerTrace> selectByIntervId(String id){
        return ((InterviewerTraceMapper)mapper).selectByIntervId(id);
    }

    /**
     * 统计添加记录
     * @param startDate
     * @param endDate
     * @param userId
     * @return
     */
    public String selectCountAdd(String startDate, String endDate, String userId) {
        return null;
    }

    @Override
    public List<InterviewerTrace> excelSelectInterview(String userId,String zoneId,String startDate,String endDate) {
        Map map = new HashMap();map.put("zoneId",zoneId);map.put("userId",userId);
        map.put("startDate",startDate);map.put("endDate",endDate);
        return ((InterviewerTraceMapper)mapper).excelSelectInterview(map);
    }

    @Override
    public List<InterviewerTrace> selectTimeOut(List<String> list) {
        return ((InterviewerTraceMapper)mapper).selectTimeOut(list);
    }
}
